#include <iostream>
#include <cmath>
using namespace std;

int minIndex(int list[], int size)
{
  int min = list[0];
  int minIndex = 0;

  for (int i = 1; i < size; i++)
    if (min > list[i])
    {
      min = list[i];
      minIndex = i;
    }

  return minIndex;
}

int main()
{
  int list[] =
  {
    1, 2, 4, 5, 10, 100, 2, -22
  };

  cout << "The index of the min is " << minIndex(list, 8) << endl;

  return 0;
}
